<template>
	<view class="">
		<view class="u-error-bg plr-20 ptb-40 u-success-light">
			<view class="u-flex u-flex-items-center">
				<u-avatar
					:text="userInfo.FAname"
					fontSize="24"
					size="60"
					randomBgColor>
				</u-avatar>
				<view class="ml-20 lh-40">
					<view class="">{{userInfo.FMemberName}}</view>
					<view class="">{{userInfo.FMemberPhone}}</view>
				</view>
			</view>
		</view>
		<view class="plr-20">
			<view class="home-cell ptb-40 u-cb-white-bg">
				<u-grid>
					<u-grid-item
						v-for="(baseListItem,baseListIndex) in baseList"
						:key="baseListIndex"
						@click="$u.route(baseListItem.url)">
						<view
							class="t-icon"
							:class="baseListItem.icon">
						</view>
						<text class="grid-text mt-10">{{baseListItem.title}}</text>
					</u-grid-item>
				</u-grid>
			</view>
			<!-- <view class="home-cell padding-20 u-cb-white-bg u-flex u-flex-between">
				<view class="u-flex u-flex-items-center u-flex-shrink-0">
					<view class="t-icon t-icon-saoma" />
					<text class="ml-10">扫码余额支付</text>
				</view>
				<view class="width-248">
					<u-button 
						text="扫一扫"
						type="error"
						shape="circle"
						size="small"
						@click="onClickScanCode"
						color="linear-gradient(to right, rgb(245,108,108 ), rgb(221,97,97))"/>
				</view>
			</view> -->
			<view class="u-cb-white-bg mt-20 u-flex u-flex-around padding-30 fsize-28">
				<view class="u-flex u-flex-y u-flex-middle">
					<view>{{userInfo.FAmount}}</view>
					<view>储值余额</view>
				</view>
				<view class="u-flex u-flex-y u-flex-middle">
					<view>{{userInfo.FIntegral}}</view>
					<view>积分</view>
				</view>
			</view>
			<view class="home-cell padding-20 u-cb-white-bg">
				<view class="fsize-32 pb-20 u-flex u-flex-between u-flex-items-center">
					<text>最近交易记录</text>
					<u-icon name="reload" color="#5ac725" size="28" @click="onUpData"/>
				</view>
				<view id="cell-list">
					<u-list :height="cellHeight" @scrolltolower="onScrollToLower">
						<u-list-item v-for="(im, ix) in cellList" :key="im.FBillNo">
							<u-cell
								:title="im.FCaption"
								:label="im.FRemark"
								center
								customStyle="customstyle">
								<view slot="icon" class="t-icon t-icon-chongzhi" />
								<view slot="value">
									<view class="u-text-align-right">{{im.FAmount}}</view>
									<view class="u-text-align-right fsize-24 mt-10">{{im.FDate}}</view>
								</view>
							</u-cell>
						</u-list-item>
					</u-list>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import getCellHeight from "@/mixins/setCellHeight.js"
	import getCellData from "@/mixins/scrollMixins.js"
	export default{
		mixins:[getCellHeight, getCellData],
		data(){
			return {
				userInfo:{},
				type: 0,
				data_type: 1,
				loadUrl: '/RptRechargeRecord',
				baseList:[
					{title:'我的资料', icon:'t-icon-ziliao', id: 'b01', url:'/packgeA/user/user-info'},
					{title:'积分明细', icon:'t-icon-toupiao', id: 'b02', url:'/packgeA/data-list/integral-detailed'},
					{title:'储值记录', icon:'t-icon-yinhangka1', id: 'b03', url:'/packgeA/data-list/recharge-detailed'}
				],
				pageSize: 6,
			}
		},
		onLoad(){
			if(wx.hideHomeButton){  
				wx.hideHomeButton();  
			}
			this.userInfo = uni.getStorageSync('userInfo')
			this.userInfo.FAname = this.userInfo.FMemberName.substring(0, 1)
			this.getData(this.loadUrl,this.pageIndex, this.pageSize, this.type, this.data_type)
		},
		methods:{
			onUpData(){
				this.pageIndex = 1
				this.cellList = []
				this.getData(this.loadUrl,this.pageIndex, this.pageSize, this.type, this.data_type)
			}
			// onClickScanCode(){
			// 	uni.scanCode({
			// 		success: res => {
			// 			console.log('dada', res)
			// 		}
			// 	})
			// }
		}
	}
</script>

<style scoped lang="scss">
	.home-cell{
		border-radius: 12upx;
		margin-top: 20upx;
	}
	::v-deep .u-cell__body.data-v-1c4434ae{
		padding: 20upx 0;
	} 
</style>